#include "Image.h"

// Constants
#define PI					3.14159265	// Used in calculations for angles


// Constants for features
#define ALL_ORIENTATIONS	0			// Selects whether orientations go from 0 to 180 (0) or 0 to 360 (1)
#define ORIENTATION_BINS	9			// Number of bins for the orientations histogram
#define EPSILON				0.01f		// Constant used to avoid division by zero for features

// Integral histogram class.
class IntegralHist
{
	public:
		IntegralHist(Image* img);				// Constructor
		IntegralHist(const IntegralHist &init);	// Copy constructor
		~IntegralHist();						// Destructor

		int _d;					// Bins of histogram
		int _w;					// Width of histogram
		int _h;					// Height of histogram
		float* _histdata;		// Integral histogram

	private:
		friend class IntegralHistPtr;
		unsigned _count;
};

// This class is a "smart" pointer for integral histograms. It 
// must only be used to point to integral histograms that were 
// created dynamically. When there are no longer any pointers 
// pointing to the integral histogram in question, it will 
// automatically delete itself.
class IntegralHistPtr
{
	public:
		IntegralHistPtr(IntegralHist* p = NULL);		// Constructor
		IntegralHistPtr(IntegralHistPtr const& init);	// Copy constructor
		~IntegralHistPtr();								// Destructor

		// Operators
		IntegralHist* operator->();
		IntegralHist& operator*();
		IntegralHistPtr& operator=(IntegralHistPtr const& p);
		bool IntegralHistPtr::operator==(const IntegralHistPtr &r) const;
		bool IntegralHistPtr::operator!=(const IntegralHistPtr &r) const;

	private:
		IntegralHist* _p;
};
